<template>
	<view class="bg-white" style="height: 100vh;">
		<cu-custom :bgColor="NavBarColor" :isBack="true" backFlag="navigate">
			<block slot="backText">返回</block>
			<block slot="content">详情</block>
		</cu-custom>
		<view>

			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view>入库单号：
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view class="text-content padding" v-html="detail.rkOrderCode">
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view>物料编号：
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view class="text-content padding" v-html="detail.materialCode">
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view>物料名称：
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view class="text-content padding" v-html="detail.materialName">
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view>数量：
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view class="text-content padding" v-html="detail.moveCount">
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view>原仓库：
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view class="text-content padding" v-html="detail.oriWarehouse_dictText">
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view>原仓位：
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view class="text-content padding" v-html="detail.oriLocation_dictText">
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view>目标仓库：
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view class="text-content padding" v-html="detail.goalWarehouse_dictText">
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view>目标仓位：
				</view>
			</view>
			<view class="desc" style="font-family: '仿宋';font-size: 18px;">
				<view class="text-content padding" v-html="detail.goalLocation_dictText">
				</view>
			</view>
			
			<view class="padding flex flex-direction">
				<button class="cu-btn bg-blue lg" @click="submitConfirm(detail)">确认</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		http
	} from '@/common/service/service.js'
	export default {
		data() {
			return {
				NavBarColor: this.NavBarColor,
				erpGoodsId: '',
				detail: {},
				goodNumber: null,
				flg: true,
				url: {
					getById: '/base/erpGoods/queryById',
					barcodeScanCheckMove: '/detail/bussInventoryDetails/barcodeScanCheckMove',

				}

			}
		},
		// onLoad:function(){
		// 	console.log("this.$Route.query",this.$Route);
		// 	let query = this.$Route.query
		// 	if(query){
		// 		this.annotation = query;
		// 		}
		// },
		onLoad: function(option) {
			const entity = JSON.parse(decodeURIComponent(option.item));
			this.detail = entity

		},
		created() {
			console.log("created");
			// this.getById(this.erpGoodsId);
		},
		methods: {
			submitConfirm(detail) {
				var that = this;
				uni.showModal({
				    title: '提示',
				    content: '确认进行此操作吗？',
				    success: function (res) {
				        if (res.confirm) {
							//
							console.log('用户点击确定');
							
							that.$http.post(that.url.barcodeScanCheckMove,detail).then(res => {
								console.log(res)
								this.$tip.loaded();
								if (res.data.success) {
									uni.navigateBack({
											delta: 1, //返回层数，2则上上页
											success() {
												uni.$emit('barcode', {
													barcode: detail.barcode
												})
											},
										});
									// let entity = res.data.result[0];
	
								}else{
									uni.navigateBack({
											delta: 1, //返回层数，2则上上页
											success() {
												uni.$emit('barcode', {
													barcode: detail.barcode
												})
											},
										});
									this.$tip.error(res.data.message)
								}
							}).catch(() => {
								this.$tip.loaded();
								this.$tip.error('提交失败')
							});

				            // 用户点击了确定，执行相应的逻辑
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				            // 用户点击了取消，执行相应的逻辑
				        }
				    }
				});
									
				
				console.log(detail)
				// this.$http.get(this.url.getById, {
				// 	params: {
				// 		id: this.erpGoodsId
				// 	}
				// }).then(res => {
				// 	//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
				// 	this.erpGoods = res.data.result
				// 	console.log("entity", this.erpGoods)
				// 	//设置列表数据
				// 	if (res.data.success) {
				// 		console.log("res", res.data)

				// 	}


				// })
			},

			numberPlus() {
				if (this.flg) {
					this.goodNumber++
					this.flg = false
				} else {
					this.goodNumber--
					if (this.goodNumber == 0) {
						this.goodNumber = null
					}
					this.flg = true
				}
			}
		}
	}
</script>

<style>
</style>